#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

//  x、y为方程系数，返回值为d、x、y
// 求ax + by = gcd(a, b) 的一个特解
ll EXTENDED_EUCLID(ll a, ll b, ll &x, ll &y) {
  if (b == 0) {
    x = 1, y = 0;
    return a;
  }
  ll d = EXTENDED_EUCLID(b, a % b, x, y);
  ll t = x;
  x = y;
  y = t - a / b * y;
  return d;
}
int main(void) {
  ll a, b, c, k;
  cin >> a >> b >> c >> k;

  ll A = c;
  ll C = b - a;
  ll B = 1ll << k; // 2^k
  ll x, y;
  ll d = EXTENDED_EUCLID(A, B, x, y);

  if (C % d != 0) // 方程 Ax=C(mod B) 无解
    cout << "Inf" << endl;
  else {
    x = (x * (C / d)) % B;               // 方程Ax+By=C的一个特解
    x = (x % (B / d) + B / d) % (B / d); // 方程Ax+By=C)的通解
    cout << x;
  }

  return 0;
}
